﻿using BlazingCoffee.Server.IO;
using BlazingCoffee.Shared.Models;
using CsvHelper;
using Microsoft.AspNetCore.Hosting;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;

namespace BlazingCoffee.Server.Data
{
    public class DbInitializer
    {
        public static void Initialize(CoffeeContext context, IWebHostEnvironment environment)
        {
            //context.Database.EnsureCreated();
            SeedSales(environment, context);
            SeedCountry(context);
            SeedTeams(context);
            SeedEmployees(context);
            SeedLocales(context);
            SeedProducts(context);
        }

        private static void SeedProducts(CoffeeContext context)
        {
            if (context.Products.Any())
            {
                return;
            }

            var products = new Product[] {
                new Product { Group = "Consumer Drink", Sku = "Black Coffee", Cost = 3 },
                new Product { Group = "Consumer Drink", Sku = "Iced Coffee", Cost = 3.5 },
                new Product { Group = "Consumer Drink", Sku = "Hot Chocolate", Cost = 2 },
                new Product { Group = "Consumer Drink", Sku = "Cappuccino", Cost = 4 },
                new Product { Group = "Consumer Drink", Sku = "Hot Tea", Cost = 2 },
                new Product { Group = "Consumer Drink", Sku = "Espresso", Cost = 7 },
                new Product { Group = "Consumer Drink", Sku = "Iced Tea", Cost = 1.5 },
                new Product { Group = "Consumer Food ", Sku = "Donut", Cost = 1 },
                new Product { Group = "Consumer Food ", Sku = "Muffin", Cost = 2 },
                new Product { Group = "Consumer Food ", Sku = "Bagel", Cost = 0.99 },
                new Product { Group = "Consumer Food ", Sku = "Croissant", Cost = 2 },
                new Product { Group = "Consumer Food ", Sku = "Signature Sandwich" , Cost = 7 },
                new Product { Group = "Whole Product ", Sku = "Classic Roast Beans", Cost = 15 },
                new Product { Group = "Whole Product ", Sku = "French Vanilla K-Cups", Cost = 13 },
                new Product { Group = "Whole Product ", Sku = "Green Tea", Cost = 12 },
                new Product { Group = "Accessory", Sku = "Gift Card", Cost = 25 },
                new Product { Group = "Accessory", Sku = "Gift Card", Cost = 50 },
                new Product { Group = "Accessory", Sku = "Store T-Shirt" , Cost = 20 },
                new Product { Group = "Accessory", Sku = "Store Hat", Cost = 15 },
                new Product { Group = "Accessory", Sku = "Store Koozie (5 pack)" , Cost = 5 }
                };

            context.Products.AddRange(products);
            context.SaveChanges();
        }

        private static void SeedTeams(CoffeeContext context)
        {
            if (context.Teams.Any())
            {
                return;
            }

            var teams = new Team[] {
                new Team{
                    TeamId = 1,
                    TeamName = "Tiger Team",
                    TeamColor =  "#FF6358"
                },
                new Team {
                    TeamId = 2,
                    TeamName = "Lemon Team",
                    TeamColor =  "#F7C62F"
                },
                new Team {
                    TeamId = 3,
                    TeamName = "Organic Team",
                    TeamColor =  "#55AB1D"
                },
                new Team {
                    TeamId = 4,
                    TeamName = "Ocean Team",
                    TeamColor =  "#28B4C8"
                }
            };

            context.Teams.AddRange(teams);
            context.SaveChanges();
        }

        private static void SeedEmployees(CoffeeContext context)
        {
            if (context.Employees.Any())
            {
                return;   // DB has been seeded
            }

            var employees = new Employee[] {
                new Employee {
                   TeamId = 3,
                   FullName = "Sig Jeannel",
                   JobTitle = "Human Resources Assistant III",
                   Country = "US",
                   IsOnline = true,
                   Rating =  3,
                   Target = 100,
                   Budget = 47601,
                   Phone = "(936) 9429601",
                   Address = "138 Buhler Avenue",
                   ImgId = 1,
                   Gender = "M",
   },
                new Employee { TeamId = 3,
    FullName = "Shelden Greyes",
    JobTitle = "Operator",
    Country = "GB",
    IsOnline = true,
    Rating =  5,
    Target = 40,
    Budget = 12253,
    Phone = "(343) 6656271",
    Address = "2 Waxwing Point",
    ImgId = 2,
    Gender = "M"},
                new Employee { TeamId = 4,

    FullName = "Megen Cody",
    JobTitle = "Operator",
    Country = "BR",
    IsOnline = true,
    Rating =  1,
    Target = 66,
    Budget = 96183,
    Phone = "(178) 2336256",
    Address = "4082 Stephen Court",
    ImgId = 6,
    Gender = "F",

         },
                new Employee { TeamId = 1,

    FullName = "Clevey Thursfield",
    JobTitle = "VP Quality Control",
    Country = "BR",
    IsOnline = true,
    Rating =  2,
    Target = 58,
    Budget = 54936,
    Phone = "(277) 7415010",
    Address = "1563 Glacier Hill Parkway",
    ImgId = 5,
    Gender = "M",

         },
                new Employee { TeamId = 2,

    FullName = "Ruthi Baldini",
    JobTitle = "Data Coordiator",
    Country = "BR",
    IsOnline = true,
    Rating =  3,
    Target = 37,
    Budget = 46572,
    Phone = "(766) 5691615",
    Address = "6 Laurel Avenue",
    ImgId = 8,
    Gender = "F",

         },
                new Employee { TeamId = 4,

    FullName = "Annecorinne Morter",
    JobTitle = "Professor",
    Country = "FR",
    IsOnline = false,
    Rating =  2,
    Target = 35,
    Budget = 37198,
    Phone = "(807) 2524830",
    Address = "106 Green Street",
    ImgId = 3,
    Gender = "F",

         },
                new Employee { TeamId = 2,

    FullName = "Gracia Punyer",
    JobTitle = "Assistant Manager",
    Country = "ES",
    IsOnline = true,
    Rating =  4,
    Target = 64,
    Budget = 84752,
    Phone = "(515) 9749536",
    Address = "69 Brentwood Alley",
    ImgId = 2,
    Gender = "F",

         },
                new Employee { TeamId = 2,

    FullName = "Duky Hurring",
    JobTitle = "Account Executive",
    Country = "BR",
    IsOnline = false,
    Rating =  3,
    Target = 61,
    Budget = -1266,
    Phone = "(897) 7202034",
    Address = "39 Morning Circle",
    ImgId = 3,
    Gender = "M",

         },
                new Employee { TeamId = 1,

    FullName = "Briana Shemelt",
    JobTitle = "Professor",
    Country = "US",
    IsOnline = false,
    Rating =  3,
    Target = 63,
    Budget = -9308,
    Phone = "(205) 2560799",
    Address = "11 Walton Court",
    ImgId = 2,
    Gender = "F",

         },
                new Employee { TeamId = 4,

    FullName = "Lexis Mostin",
    JobTitle = "Analyst Programmer",
    Country = "FR",
    IsOnline = true,
    Rating =  4,
    Target = 81,
    Budget = 38153,
    Phone = "(903) 8388089",
    Address = "38547 Westend Way",
    ImgId = 4,
    Gender = "F",

         },
                new Employee { TeamId = 2,

    FullName = "Felizio Gooda",
    JobTitle = "GIS Technical Architect",
    Country = "DE",
    IsOnline = true,
    Rating =  3,
    Target = 89,
    Budget = 81585,
    Phone = "(372) 2389397",
    Address = "9 Summer Ridge Circle",
    ImgId = 2,
    Gender = "M",

         },
                new Employee { TeamId = 2,

    FullName = "Aubry Oxberry",
    JobTitle = "Financial Advisor",
    Country = "BR",
    IsOnline = false,
    Rating =  2,
    Target = 3,
    Budget = -6095,
    Phone = "(665) 4176083",
    Address = "06 Lerdahl Point",
    ImgId = 10,
    Gender = "F",

         },
                new Employee { TeamId = 1,

    FullName = "Orly Glasbey",
    JobTitle = "Environmental Tech",
    Country = "BR",
    IsOnline = true,
    Rating =  5,
    Target = 63,
    Budget = 63945,
    Phone = "(449) 8482879",
    Address = "4035 Porter Parkway",
    ImgId = 6,
    Gender = "F",

         },
                new Employee { TeamId = 4,

    FullName = "Stephanus Culp",
    JobTitle = "Cost Accountant",
    Country = "BR",
    IsOnline = false,
    Rating =  2,
    Target = 60,
    Budget = 10613,
    Phone = "(148) 3124030",
    Address = "57028 Moland Terrace",
    ImgId = 8,
    Gender = "M",

         },
                new Employee { TeamId = 2,

    FullName = "Roseanna Janecek",
    JobTitle = "Database Administrator IV",
    Country = "FR",
    IsOnline = false,
    Rating =  4,
    Target = 97,
    Budget = 77351,
    Phone = "(125) 4421623",
    Address = "21973 Beilfuss Alley",
    ImgId = 4,
    Gender = "F",

         },
                new Employee { TeamId = 1,

    FullName = "Weidar McCombe",
    JobTitle = "Civil Engineer",
    Country = "FR",
    IsOnline = true,
    Rating =  1,
    Target = 77,
    Budget = 35924,
    Phone = "(488) 7911627",
    Address = "7 Dahle Terrace",
    ImgId = 1,
    Gender = "M",

         },
                new Employee { TeamId = 4,

    FullName = "Evelin Spirritt",
    JobTitle = "Analyst Programmer",
    Country = "BR",
    IsOnline = false,
    Rating =  2,
    Target = 18,
    Budget = 58552,
    Phone = "(821) 9538078",
    Address = "89418 Knutson Pass",
    ImgId = 1,
    Gender = "M",

         },
                new Employee { TeamId = 2,

    FullName = "Andria Helbeck",
    JobTitle = "Nurse Practicioner",
    Country = "BR",
    IsOnline = true,
    Rating =  4,
    Target = 53,
    Budget = 72526,
    Phone = "(387) 9614638",
    Address = "8589 Vernon Drive",
    ImgId = 8,
    Gender = "F",

         },
                new Employee { TeamId = 1,

    FullName = "Mariellen Ravelus",
    JobTitle = "Systems Administrator I",
    Country = "DE",
    IsOnline = true,
    Rating =  2,
    Target = 22,
    Budget = -6659,
    Phone = "(300) 6741661",
    Address = "707 Gale Hill",
    ImgId = 9,
    Gender = "F",

         },
                new Employee { TeamId = 3,

    FullName = "Corri Pergens",
    JobTitle = "Help Desk Operator",
    Country = "BR",
    IsOnline = true,
    Rating =  2,
    Target = 74,
    Budget = 12376,
    Phone = "(769) 7145603",
    Address = "856 Forest Crossing",
    ImgId = 3,
    Gender = "F",

         },
                new Employee { TeamId = 3,

    FullName = "Friedrick Macknish",
    JobTitle = "Human Resources Assistant II",
    Country = "FR",
    IsOnline = true,
    Rating =  2,
    Target = 38,
    Budget = 97848,
    Phone = "(196) 4156385",
    Address = "157 Talisman Trail",
    ImgId = 9,
    Gender = "M",

         },
                new Employee { TeamId = 4,

    FullName = "Georgette Trevorrow",
    JobTitle = "VP Accounting",
    Country = "FR",
    IsOnline = true,
    Rating =  3,
    Target = 3,
    Budget = 17327,
    Phone = "(319) 1412549",
    Address = "07 Marquette Point",
    ImgId = 3,
    Gender = "F",

         },
                new Employee { TeamId = 4,

    FullName = "Vanya Goalby",
    JobTitle = "Senior Cost Accountant",
    Country = "FR",
    IsOnline = false,
    Rating =  2,
    Target = 77,
    Budget = 33584,
    Phone = "(496) 7538982",
    Address = "2192 Iowa Lane",
    ImgId = 6,
    Gender = "F",

         },
                new Employee { TeamId = 1,

    FullName = "Abel Ansell",
    JobTitle = "Actuary",
    Country = "US",
    IsOnline = false,
    Rating =  4,
    Target = 52,
    Budget = 12312,
    Phone = "(571) 9908377",
    Address = "4355 Iowa Parkway",
    ImgId = 4,
    Gender = "M",

         },
                new Employee { TeamId = 2,

    FullName = "Odille Barus",
    JobTitle = "Speech Pathologist",
    Country = "FR",
    IsOnline = true,
    Rating =  4,
    Target = 60,
    Budget = 46911,
    Phone = "(974) 1137672",
    Address = "496 Lotheville Avenue",
    ImgId = 8,
    Gender = "F",

         },
                new Employee { TeamId = 4,

    FullName = "Rudolf Consadine",
    JobTitle = "Structural Analysis Engineer",
    Country = "FR",
    IsOnline = true,
    Rating =  4,
    Target = 20,
    Budget = 94258,
    Phone = "(450) 7612220",
    Address = "93 Thierer Park",
    ImgId = 6,
    Gender = "M",

         },
                new Employee { TeamId = 3,

    FullName = "Christabel Bick",
    JobTitle = "Engineer III",
    Country = "FR",
    IsOnline = true,
    Rating =  5,
    Target = 0,
    Budget = 65359,
    Phone = "(361) 5159566",
    Address = "191 Bunting Pass",
    ImgId = 5,
    Gender = "F",

         },
                new Employee { TeamId = 3,

    FullName = "Lancelot Tanzer",
    JobTitle = "Senior Developer",
    Country = "US",
    IsOnline = true,
    Rating =  5,
    Target = 80,
    Budget = 13246,
    Phone = "(502) 3949900",
    Address = "4287 Corben Plaza",
    ImgId = 8,
    Gender = "M",

         },
                new Employee { TeamId = 4,

    FullName = "Bink Byk",
    JobTitle = "Software Engineer I",
    Country = "FR",
    IsOnline = false,
    Rating =  3,
    Target = 17,
    Budget = 56472,
    Phone = "(475) 9070061",
    Address = "075 Eggendart Avenue",
    ImgId = 9,
    Gender = "M",

         },
                new Employee { TeamId = 1,

    FullName = "Rhys Pheazey",
    JobTitle = "Speech Pathologist",
    Country = "BR",
    IsOnline = false,
    Rating =  5,
    Target = 98,
    Budget = 62483,
    Phone = "(365) 8904529",
    Address = "987 Carioca Lane",
    ImgId = 9,
    Gender = "M",

         },
                new Employee { TeamId = 1,

    FullName = "Lyndell Howieson",
    JobTitle = "Speech Pathologist",
    Country = "DE",
    IsOnline = true,
    Rating =  2,
    Target = 82,
    Budget = 16694,
    Phone = "(461) 3130038",
    Address = "9 Pennsylvania Crossing",
    ImgId = 8,
    Gender = "F",

         },
                new Employee { TeamId = 1,

    FullName = "Cassey Fitchell",
    JobTitle = "Software Engineer III",
    Country = "FR",
    IsOnline = true,
    Rating =  2,
    Target = 10,
    Budget = 91253,
    Phone = "(985) 5060547",
    Address = "652 Merry Place",
    ImgId = 9,
    Gender = "F",

         },
                new Employee { TeamId = 4,

    FullName = "Coralyn Steljes",
    JobTitle = "Accounting Assistant III",
    Country = "FR",
    IsOnline = false,
    Rating =  2,
    Target = 81,
    Budget = -9871,
    Phone = "(760) 5696853",
    Address = "4 Norway Maple Pass",
    ImgId = 9,
    Gender = "F",

         },
                new Employee { TeamId = 2,

    FullName = "Bruis Creavin",
    JobTitle = "Nuclear Power Engineer",
    Country = "BR",
    IsOnline = false,
    Rating =  1,
    Target = 59,
    Budget = -5798,
    Phone = "(570) 8801169",
    Address = "71 Carioca Park",
    ImgId = 6,
    Gender = "M",

         },
                new Employee { TeamId = 2,

    FullName = "Adrianne Peery",
    JobTitle = "Chief Design Engineer",
    Country = "FR",
    IsOnline = false,
    Rating =  2,
    Target = 2,
    Budget = 56575,
    Phone = "(793) 1143493",
    Address = "3 2nd Drive",
    ImgId = 7,
    Gender = "F",

         },
                new Employee { TeamId = 2,

    FullName = "Port Gerauld",
    JobTitle = "Senior Cost Accountant",
    Country = "FR",
    IsOnline = true,
    Rating =  2,
    Target = 27,
    Budget = 97919,
    Phone = "(155) 5488067",
    Address = "9 High Crossing Center",
    ImgId = 5,
    Gender = "M",

         },
                new Employee { TeamId = 1,

    FullName = "Boy Antoszewski",
    JobTitle = "VP Accounting",
    Country = "GB",
    IsOnline = true,
    Rating =  2,
    Target = 11,
    Budget = 74779,
    Phone = "(715) 9192627",
    Address = "3773 Hazelcrest Road",
    ImgId = 6,
    Gender = "M",

         },
                new Employee { TeamId = 1,

    FullName = "Gib Yakebowitch",
    JobTitle = "Marketing Assistant",
    Country = "BR",
    IsOnline = false,
    Rating =  5,
    Target = 57,
    Budget = 89028,
    Phone = "(923) 6953600",
    Address = "7 Mariners Cove Point",
    ImgId = 8,
    Gender = "M",

         },
                new Employee { TeamId = 1,

    FullName = "Minerva Gilders",
    JobTitle = "Administrative Officer",
    Country = "BR",
    IsOnline = false,
    Rating =  3,
    Target = 54,
    Budget = 32267,
    Phone = "(773) 8863232",
    Address = "82 Annamark Way",
    ImgId = 4,
    Gender = "F",

         },
                new Employee { TeamId = 3,

    FullName = "Wait Peperell",
    JobTitle = "Sales Representative",
    Country = "US",
    IsOnline = true,
    Rating =  4,
    Target = 94,
    Budget = 72251,
    Phone = "(419) 5806752",
    Address = "0355 Petterle Avenue",
    ImgId = 1,
    Gender = "M",

         },
                new Employee { TeamId = 3,

    FullName = "Ailsun Esmead",
    JobTitle = "Software Test Engineer III",
    Country = "FR",
    IsOnline = true,
    Rating =  1,
    Target = 12,
    Budget = 69596,
    Phone = "(852) 7039628",
    Address = "0 Lunder Crossing",
    ImgId = 8,
    Gender = "F",

         },
                new Employee { TeamId = 2,

    FullName = "Vallie Van der Velde",
    JobTitle = "Nurse",
    Country = "GB",
    IsOnline = true,
    Rating =  3,
    Target = 89,
    Budget = 19530,
    Phone = "(331) 7690832",
    Address = "2 Almo Lane",
    ImgId = 4,
    Gender = "F",

         },
                new Employee { TeamId = 1,

    FullName = "Dov Amber",
    JobTitle = "Sales Representative",
    Country = "FR",
    IsOnline = false,
    Rating =  4,
    Target = 55,
    Budget = 61106,
    Phone = "(793) 4768356",
    Address = "4 Rockefeller Street",
    ImgId = 3,
    Gender = "M",

         },
                new Employee { TeamId = 3,

    FullName = "Tedie Alu",
    JobTitle = "Business Systems Analyst",
    Country = "FR",
    IsOnline = false,
    Rating =  1,
    Target = 76,
    Budget = 3114,
    Phone = "(602) 5831373",
    Address = "28 Claremont Plaza",
    ImgId = 5,
    Gender = "M",

         },
                new Employee { TeamId = 4,

    FullName = "Tally Rizzi",
    JobTitle = "Civil Engineer",
    Country = "US",
    IsOnline = false,
    Rating =  1,
    Target = 5,
    Budget = 78575,
    Phone = "(302) 6856300",
    Address = "1 Roth Park",
    ImgId = 10,
    Gender = "M",

         },
                new Employee { TeamId = 2,

    FullName = "Ilise Lewnden",
    JobTitle = "Database Administrator I",
    Country = "BR",
    IsOnline = false,
    Rating =  4,
    Target = 33,
    Budget = -1059,
    Phone = "(659) 8660881",
    Address = "19 Stuart Alley",
    ImgId = 2,
    Gender = "F",

         },
                new Employee { TeamId = 1,

    FullName = "Farr Penwright",
    JobTitle = "Senior Editor",
    Country = "US",
    IsOnline = true,
    Rating =  3,
    Target = 82,
    Budget = 30505,
    Phone = "(505) 3900066",
    Address = "9200 Karstens Crossing",
    ImgId = 6,
    Gender = "M",

         },
                new Employee { TeamId = 1,

    FullName = "Chantal Bidgod",
    JobTitle = "Vice President, Sales",
    Country = "BR",
    IsOnline = false,
    Rating =  3,
    Target = 62,
    Budget = 25742,
    Phone = "(746) 3962702",
    Address = "8807 Kinsman Drive",
    ImgId = 2,
    Gender = "F",

         },
                new Employee { TeamId = 3,

    FullName = "Johanna Bergin",
    JobTitle = "Electrical Engineer",
    Country = "BR",
    IsOnline = false,
    Rating =  2,
    Target = 54,
    Budget = 25864,
    Phone = "(720) 6442547",
    Address = "93166 Spohn Court",
    ImgId = 3,
    Gender = "F",

         },
                new Employee { TeamId = 1,

    FullName = "Padriac Syphas",
    JobTitle = "Marketing Assistant",
    Country = "BR",
    IsOnline = true,
    Rating =  1,
    Target = 50,
    Budget = 20879,
    Phone = "(606) 9062546",
    Address = "50465 Buena Vista Plaza",
    ImgId = 5,
    Gender = "M",

         },
                new Employee { TeamId = 3,

    FullName = "Garey De Maria",
    JobTitle = "Operator",
    Country = "US",
    IsOnline = true,
    Rating =  2,
    Target = 54,
    Budget = 94251,
    Phone = "(972) 1133958",
    Address = "24 Maple Wood Terrace",
    ImgId = 9,
    Gender = "M",

         },
                new Employee { TeamId = 2,

    FullName = "Glenn Thorwarth",
    JobTitle = "Developer IV",
    Country = "BR",
    IsOnline = false,
    Rating =  5,
    Target = 39,
    Budget = 33511,
    Phone = "(394) 3115946",
    Address = "8 Dryden Park",
    ImgId = 1,
    Gender = "M",

         },
                new Employee { TeamId = 4,

    FullName = "Bron Crosson",
    JobTitle = "Sales Representative",
    Country = "FR",
    IsOnline = true,
    Rating =  2,
    Target = 80,
    Budget = 62081,
    Phone = "(686) 7934926",
    Address = "974 Mayfield Place",
    ImgId = 9,
    Gender = "M",

         },
                new Employee { TeamId = 4,

    FullName = "Garey Malecky",
    JobTitle = "Account Executive",
    Country = "BR",
    IsOnline = false,
    Rating =  5,
    Target = 51,
    Budget = 76354,
    Phone = "(304) 6324519",
    Address = "3 Paget Court",
    ImgId = 9,
    Gender = "M",

         },
                new Employee { TeamId = 2,

    FullName = "Elisabet Kimblin",
    JobTitle = "Automation Specialist I",
    Country = "US",
    IsOnline = true,
    Rating =  3,
    Target = 35,
    Budget = 26755,
    Phone = "(904) 3334563",
    Address = "75 Buell Court",
    ImgId = 1,
    Gender = "F",

         },
                new Employee { TeamId = 2,

    FullName = "Berk Uttley",
    JobTitle = "Health Coach IV",
    Country = "FR",
    IsOnline = false,
    Rating =  4,
    Target = 58,
    Budget = 82064,
    Phone = "(200) 2124940",
    Address = "4 Mockingbird Trail",
    ImgId = 8,
    Gender = "M",

         },
                new Employee { TeamId = 4,

    FullName = "Kenny Clackers",
    JobTitle = "Assistant Manager",
    Country = "FR",
    IsOnline = true,
    Rating =  4,
    Target = 37,
    Budget = 47477,
    Phone = "(926) 3235464",
    Address = "53315 Bashford Lane",
    ImgId = 2,
    Gender = "M",

         },
                new Employee { TeamId = 1,

    FullName = "Rickard Pingston",
    JobTitle = "Sales Representative",
    Country = "BR",
    IsOnline = true,
    Rating =  5,
    Target = 72,
    Budget = 94173,
    Phone = "(902) 4658383",
    Address = "8 Mesta Court",
    ImgId = 2,
    Gender = "M",

         },
                new Employee { TeamId = 4,

    FullName = "Hobard Clabburn",
    JobTitle = "Sales Representative",
    Country = "BR",
    IsOnline = true,
    Rating =  2,
    Target = 37,
    Budget = 66166,
    Phone = "(711) 6587550",
    Address = "29796 Mcbride Court",
    ImgId = 4,
    Gender = "M",

         },
                new Employee { TeamId = 2,

    FullName = "Uri Champken",
    JobTitle = "Software Test Engineer IV",
    Country = "BR",
    IsOnline = false,
    Rating =  1,
    Target = 39,
    Budget = 65176,
    Phone = "(514) 1953919",
    Address = "78 Rowland Alley",
    ImgId = 6,
    Gender = "M",

         },
                new Employee { TeamId = 1,

    FullName = "Obidiah Fold",
    JobTitle = "Budget/Accounting Analyst I",
    Country = "FR",
    IsOnline = false,
    Rating =  5,
    Target = 66,
    Budget = 74529,
    Phone = "(747) 8711780",
    Address = "58 Lakeland Court",
    ImgId = 9,
    Gender = "M",

         },
                new Employee { TeamId = 2,

    FullName = "Angelia Marconi",
    JobTitle = "Associate Professor",
    Country = "FR",
    IsOnline = false,
    Rating =  4,
    Target = 91,
    Budget = 38996,
    Phone = "(530) 7506861",
    Address = "7 Ohio Parkway",
    ImgId = 2,
    Gender = "F",

         },
                new Employee { TeamId = 3,

    FullName = "Ronda Lock",
    JobTitle = "Quality Engineer",
    Country = "US",
    IsOnline = false,
    Rating =  5,
    Target = 36,
    Budget = 69903,
    Phone = "(916) 6819628",
    Address = "802 American Ash Street",
    ImgId = 6,
    Gender = "F",

         },
                new Employee { TeamId = 4,

    FullName = "Rachele Fantham",
    JobTitle = "Business Systems Analyst",
    Country = "FR",
    IsOnline = true,
    Rating =  2,
    Target = 100,
    Budget = 79333,
    Phone = "(652) 3112938",
    Address = "62 Grim Center",
    ImgId = 4,
    Gender = "F",

         },
                new Employee { TeamId = 4,

    FullName = "Emanuel Deery",
    JobTitle = "Sales Representative",
    Country = "BR",
    IsOnline = false,
    Rating =  3,
    Target = 93,
    Budget = 77477,
    Phone = "(860) 8318923",
    Address = "850 Mifflin Junction",
    ImgId = 8,
    Gender = "M",

         },
                new Employee { TeamId = 4,

    FullName = "Clay Ellins",
    JobTitle = "Design Engineer",
    Country = "US",
    IsOnline = true,
    Rating =  4,
    Target = 98,
    Budget = 4120,
    Phone = "(682) 4688237",
    Address = "458 Scoville Lane",
    ImgId = 5,
    Gender = "M",

         },
                new Employee { TeamId = 4,

    FullName = "Bettina Menlove",
    JobTitle = "Senior Financial Analyst",
    Country = "FR",
    IsOnline = false,
    Rating =  5,
    Target = 78,
    Budget = 80574,
    Phone = "(293) 8801412",
    Address = "29 Onsgard Junction",
    ImgId = 8,
    Gender = "F",

         },
                new Employee { TeamId = 2,

    FullName = "Claiborne Willoughey",
    JobTitle = "Food Chemist",
    Country = "US",
    IsOnline = true,
    Rating =  5,
    Target = 44,
    Budget = 44673,
    Phone = "(707) 3380798",
    Address = "39114 Killdeer Terrace",
    ImgId = 6,
    Gender = "M",

         },
                new Employee { TeamId = 3,

    FullName = "Desmond Gritskov",
    JobTitle = "Pharmacist",
    Country = "BR",
    IsOnline = false,
    Rating =  4,
    Target = 66,
    Budget = 45319,
    Phone = "(412) 1336481",
    Address = "6912 Farwell Street",
    ImgId = 6,
    Gender = "M",

         },
                new Employee { TeamId = 2,

    FullName = "Codee Maybery",
    JobTitle = "Clinical Specialist",
    Country = "US",
    IsOnline = true,
    Rating =  2,
    Target = 26,
    Budget = 43462,
    Phone = "(682) 7969803",
    Address = "4 Tennessee Plaza",
    ImgId = 3,
    Gender = "F",

         },
                new Employee { TeamId = 3,

    FullName = "Denys Beynke",
    JobTitle = "Occupational Therapist",
    Country = "BR",
    IsOnline = true,
    Rating =  4,
    Target = 60,
    Budget = 32402,
    Phone = "(110) 4341370",
    Address = "99 Trailsway Park",
    ImgId = 4,
    Gender = "M",

         },
                new Employee { TeamId = 2,

    FullName = "Guthry Limpricht",
    JobTitle = "Geologist II",
    Country = "DE",
    IsOnline = true,
    Rating =  3,
    Target = 65,
    Budget = 68462,
    Phone = "(100) 8946768",
    Address = "3117 Commercial Crossing",
    ImgId = 2,
    Gender = "M",

         },
                new Employee { TeamId = 3,

    FullName = "Cammie Knoble",
    JobTitle = "Community Outreach Specialist",
    Country = "GB",
    IsOnline = false,
    Rating =  2,
    Target = 1,
    Budget = 70198,
    Phone = "(352) 1663192",
    Address = "55 Longview Place",
    ImgId = 4,
    Gender = "F",

         },
                new Employee { TeamId = 3,

    FullName = "Kiri Espinal",
    JobTitle = "Accounting Assistant I",
    Country = "FR",
    IsOnline = false,
    Rating =  3,
    Target = 47,
    Budget = 3712,
    Phone = "(946) 6686147",
    Address = "90480 Chinook Drive",
    ImgId = 4,
    Gender = "F",

         },
                new Employee { TeamId = 3,

    FullName = "Joy Tiddy",
    JobTitle = "Engineer III",
    Country = "FR",
    IsOnline = true,
    Rating =  5,
    Target = 80,
    Budget = 61355,
    Phone = "(849) 1097790",
    Address = "76 Summerview Hill",
    ImgId = 9,
    Gender = "F",

         },
                new Employee { TeamId = 1,

    FullName = "Arlene Karlsson",
    JobTitle = "Civil Engineer",
    Country = "BR",
    IsOnline = true,
    Rating =  4,
    Target = 98,
    Budget = 14267,
    Phone = "(699) 4713080",
    Address = "90 Dorton Point",
    ImgId = 5,
    Gender = "F",

         },
                new Employee { TeamId = 2,

    FullName = "Melony Millwater",
    JobTitle = "Sales Representative",
    Country = "US",
    IsOnline = true,
    Rating =  2,
    Target = 27,
    Budget = 67126,
    Phone = "(352) 5197697",
    Address = "65242 Derek Place",
    ImgId = 1,
    Gender = "F",

         },
                new Employee { TeamId = 2,

    FullName = "Mab Ballham",
    JobTitle = "Sales Representative",
    Country = "FR",
    IsOnline = false,
    Rating =  1,
    Target = 34,
    Budget = 65648,
    Phone = "(699) 9285470",
    Address = "2579 Messerschmidt Crossing",
    ImgId = 8,
    Gender = "F",

         },
                new Employee { TeamId = 2,

    FullName = "Nixie MacAskie",
    JobTitle = "Structural Analysis Engineer",
    Country = "BR",
    IsOnline = true,
    Rating =  2,
    Target = 13,
    Budget = -5312,
    Phone = "(434) 6153212",
    Address = "59672 Village Court",
    ImgId = 4,
    Gender = "F",

         },
                new Employee { TeamId = 1,

    FullName = "Gianni Crafts",
    JobTitle = "Tax Accountant",
    Country = "FR",
    IsOnline = false,
    Rating =  3,
    Target = 54,
    Budget = 85744,
    Phone = "(428) 3135618",
    Address = "53766 Buhler Parkway",
    ImgId = 8,
    Gender = "M",

         },
                new Employee { TeamId = 1,

    FullName = "Moyra Summerlie",
    JobTitle = "Business Systems Analyst",
    Country = "FR",
    IsOnline = true,
    Rating =  5,
    Target = 3,
    Budget = 19109,
    Phone = "(960) 7792763",
    Address = "127 Spohn Crossing",
    ImgId = 6,
    Gender = "F",

         },
                new Employee { TeamId = 3,

    FullName = "Hagan Trevers",
    JobTitle = "Sales Representative",
    Country = "FR",
    IsOnline = false,
    Rating =  2,
    Target = 93,
    Budget = 28290,
    Phone = "(749) 8913157",
    Address = "516 Clove Road",
    ImgId = 7,
    Gender = "M",

         },
                new Employee { TeamId = 3,

    FullName = "Sela Westmacott",
    JobTitle = "Account Executive",
    Country = "BR",
    IsOnline = false,
    Rating =  3,
    Target = 29,
    Budget = 58239,
    Phone = "(130) 9778509",
    Address = "81 Maple Point",
    ImgId = 2,
    Gender = "F",

         },
                new Employee { TeamId = 2,

    FullName = "Lilia Wiz",
    JobTitle = "VP Product Management",
    Country = "FR",
    IsOnline = false,
    Rating =  1,
    Target = 65,
    Budget = 1438,
    Phone = "(418) 5940094",
    Address = "905 Hauk Point",
    ImgId = 1,
    Gender = "F",

         },
                new Employee { TeamId = 1,

    FullName = "Orlan MacAlpin",
    JobTitle = "Statistician I",
    Country = "US",
    IsOnline = false,
    Rating =  1,
    Target = 1,
    Budget = 9094,
    Phone = "(512) 7106617",
    Address = "6055 Truax Way",
    ImgId = 2,
    Gender = "M",

         },
                new Employee { TeamId = 2,

    FullName = "Ty Nutton",
    JobTitle = "Speech Pathologist",
    Country = "FR",
    IsOnline = false,
    Rating =  5,
    Target = 88,
    Budget = 76684,
    Phone = "(250) 2530424",
    Address = "37247 Merry Plaza",
    ImgId = 1,
    Gender = "M",

         },
                new Employee { TeamId = 1,

    FullName = "Mirelle Jandl",
    JobTitle = "Civil Engineer",
    Country = "DE",
    IsOnline = true,
    Rating =  3,
    Target = 19,
    Budget = 94486,
    Phone = "(871) 7917453",
    Address = "31 Anderson Hill",
    ImgId = 10,
    Gender = "F",

         },
                new Employee { TeamId = 4,

    FullName = "Diann Bertram",
    JobTitle = "Structural Engineer",
    Country = "BR",
    IsOnline = true,
    Rating =  2,
    Target = 38,
    Budget = 2769,
    Phone = "(716) 9445650",
    Address = "958 Swallow Drive",
    ImgId = 4,
    Gender = "F",

         },
                new Employee { TeamId = 1,

    FullName = "Cindra Slobom",
    JobTitle = "Web Designer III",
    Country = "BR",
    IsOnline = true,
    Rating =  5,
    Target = 48,
    Budget = 81624,
    Phone = "(409) 9223432",
    Address = "82525 Northridge Junction",
    ImgId = 1,
    Gender = "F",

         },
                new Employee { TeamId = 2,

    FullName = "Tymon Mattheissen",
    JobTitle = "Dental Hygienist",
    Country = "FR",
    IsOnline = false,
    Rating =  2,
    Target = 51,
    Budget = 42972,
    Phone = "(724) 3234885",
    Address = "64363 Anzinger Plaza",
    ImgId = 3,
    Gender = "M",

         },
                new Employee { TeamId = 4,

    FullName = "Fancie Heighton",
    JobTitle = "Paralegal",
    Country = "FR",
    IsOnline = true,
    Rating =  5,
    Target = 52,
    Budget = 67403,
    Phone = "(738) 9982239",
    Address = "4353 Hermina Junction",
    ImgId = 1,
    Gender = "F",

         },
                new Employee { TeamId = 4,

    FullName = "Kit Utteridge",
    JobTitle = "Office Assistant I",
    Country = "FR",
    IsOnline = true,
    Rating =  4,
    Target = 93,
    Budget = 36268,
    Phone = "(710) 2371400",
    Address = "46806 Moland Center",
    ImgId = 7,
    Gender = "F",

         },
                new Employee { TeamId = 3,

    FullName = "Lea Willey",
    JobTitle = "VP Quality Control",
    Country = "US",
    IsOnline = false,
    Rating =  3,
    Target = 19,
    Budget = 54614,
    Phone = "(304) 3327700",
    Address = "1 Moland Crossing",
    ImgId = 6,
    Gender = "F",

         },
                new Employee { TeamId = 1,

    FullName = "Arri Halton",
    JobTitle = "Staff Accountant II",
    Country = "GB",
    IsOnline = true,
    Rating =  5,
    Target = 73,
    Budget = 32500,
    Phone = "(743) 8449571",
    Address = "3 Starling Trail",
    ImgId = 3,
    Gender = "M",

         },
                new Employee { TeamId = 2,

    FullName = "Malva Pierpoint",
    JobTitle = "Operator",
    Country = "US",
    IsOnline = true,
    Rating =  4,
    Target = 98,
    Budget = 20312,
    Phone = "(423) 8195288",
    Address = "57584 Algoma Plaza",
    ImgId = 1,
    Gender = "F",

         },
                new Employee { TeamId = 2,

    FullName = "Dalston Sabben",
    JobTitle = "Social Worker",
    Country = "BR",
    IsOnline = true,
    Rating =  4,
    Target = 85,
    Budget = 99048,
    Phone = "(388) 2523908",
    Address = "53578 Clove Lane",
    ImgId = 4,
    Gender = "M",

         },
                new Employee { TeamId = 3,

    FullName = "Delinda Margrie",
    JobTitle = "Financial Advisor",
    Country = "US",
    IsOnline = false,
    Rating =  1,
    Target = 1,
    Budget = 8398,
    Phone = "(702) 6480692",
    Address = "9 Dapin Plaza",
    ImgId = 9,
    Gender = "F",

         },
                new Employee { TeamId = 3,

    FullName = "Meggi Westman",
    JobTitle = "Librarian",
    Country = "US",
    IsOnline = true,
    Rating =  3,
    Target = 64,
    Budget = 63413,
    Phone = "(682) 3495155",
    Address = "82 Duke Terrace",
    ImgId = 7,
    Gender = "F",

         },
                new Employee { TeamId = 4,

    FullName = "Bret Barnsdall",
    JobTitle = "Registered Nurse",
    Country = "BR",
    IsOnline = true,
    Rating =  3,
    Target = 52,
    Budget = 55153,
    Phone = "(222) 2089814",
    Address = "4 Corry Park",
    ImgId = 8,
    Gender = "M",

         },
                new Employee { TeamId = 4,

    FullName = "Matthus Shyres",
    JobTitle = "Marketing Manager",
    Country = "FR",
    IsOnline = false,
    Rating =  3,
    Target = 68,
    Budget = 33697,
    Phone = "(539) 9486139",
    Address = "460 Norway Maple Junction",
    ImgId = 1,
    Gender = "M",

         }
            };

            context.Employees.AddRange(employees);
            context.SaveChanges();
        }

        private static void SeedCountry(CoffeeContext context)
        {
            if (context.Countries.Any())
            {
                return;   // DB has been seeded
            }

            var countries = new Country[] {
                new Country { Name = "Afghanistan", Code = "AF", Region = "APAC", Continent = "AS" },
                new Country { Name = "Åland Islands", Code = "AX", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Albania", Code = "AL", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Algeria", Code = "DZ", Region = "Other", Continent = "AF" },
                new Country { Name = "American Samoa", Code = "AS", Region = "APAC", Continent = "OC" },
                new Country { Name = "AndorrA", Code = "AD", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Angola", Code = "AO", Region = "Other", Continent = "AF" },
                new Country { Name = "Anguilla", Code = "AI", Region = "NA", Continent = "NA" },
                new Country { Name = "Antarctica", Code = "AQ", Region = "Other", Continent = "AN" },
                new Country { Name = "Antigua and Barbuda", Code = "AG", Region = "NA", Continent = "NA" },
                new Country { Name = "Argentina", Code = "AR", Region = "CALA", Continent = "SA" },
                new Country { Name = "Armenia", Code = "AM", Region = "APAC", Continent = "AS" },
                new Country { Name = "Aruba", Code = "AW", Region = "NA", Continent = "NA" },
                new Country { Name = "Australia", Code = "AU", Region = "APAC", Continent = "OC" },
                new Country { Name = "Austria", Code = "AT", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Azerbaijan", Code = "AZ", Region = "APAC", Continent = "AS" },
                new Country { Name = "Bahamas", Code = "BS", Region = "NA", Continent = "NA" },
                new Country { Name = "Bahrain", Code = "BH", Region = "APAC", Continent = "AS" },
                new Country { Name = "Bangladesh", Code = "BD", Region = "APAC", Continent = "AS" },
                new Country { Name = "Barbados", Code = "BB", Region = "NA", Continent = "NA" },
                new Country { Name = "Belarus", Code = "BY", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Belgium", Code = "BE", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Belize", Code = "BZ", Region = "NA", Continent = "NA" },
                new Country { Name = "Benin", Code = "BJ", Region = "Other", Continent = "AF" },
                new Country { Name = "Bermuda", Code = "BM", Region = "NA", Continent = "NA" },
                new Country { Name = "Bhutan", Code = "BT", Region = "APAC", Continent = "AS" },
                new Country { Name = "Bolivia", Code = "BO", Region = "CALA", Continent = "SA" },
                new Country { Name = "Bosnia and Herzegovina", Code = "BA", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Botswana", Code = "BW", Region = "Other", Continent = "AF" },
                new Country { Name = "Bouvet Island", Code = "BV", Region = "Other", Continent = "AN" },
                new Country { Name = "Brazil", Code = "BR", Region = "CALA", Continent = "SA" },
                new Country { Name = "British Indian Ocean Territory", Code = "IO", Region = "APAC", Continent = "AS" },
                new Country { Name = "Brunei Darussalam", Code = "BN", Region = "APAC", Continent = "AS" },
                new Country { Name = "Bulgaria", Code = "BG", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Burkina Faso", Code = "BF", Region = "Other", Continent = "AF" },
                new Country { Name = "Burundi", Code = "BI", Region = "Other", Continent = "AF" },
                new Country { Name = "Cambodia", Code = "KH", Region = "APAC", Continent = "AS" },
                new Country { Name = "Cameroon", Code = "CM", Region = "Other", Continent = "AF" },
                new Country { Name = "Canada", Code = "CA", Region = "NA", Continent = "NA" },
                new Country { Name = "Cape Verde", Code = "CV", Region = "Other", Continent = "AF" },
                new Country { Name = "Cayman Islands", Code = "KY", Region = "NA", Continent = "NA" },
                new Country { Name = "Central African Republic", Code = "CF", Region = "Other", Continent = "AF" },
                new Country { Name = "Chad", Code = "TD", Region = "Other", Continent = "AF" },
                new Country { Name = "Chile", Code = "CL", Region = "CALA", Continent = "SA" },
                new Country { Name = "China", Code = "CN", Region = "APAC", Continent = "AS" },
                new Country { Name = "Christmas Island", Code = "CX", Region = "APAC", Continent = "AS" },
                new Country { Name = "Cocos (Keeling) Islands", Code = "CC", Region = "APAC", Continent = "AS" },
                new Country { Name = "Colombia", Code = "CO", Region = "CALA", Continent = "SA" },
                new Country { Name = "Comoros", Code = "KM", Region = "Other", Continent = "AF" },
                new Country { Name = "Congo", Code = "CG", Region = "Other", Continent = "AF" },
                new Country { Name = "Congo, The Democratic Republic of the", Code = "CD", Region = "Other", Continent = "AF" },
                new Country { Name = "Cook Islands", Code = "CK", Region = "APAC", Continent = "OC" },
                new Country { Name = "Costa Rica", Code = "CR", Region = "NA", Continent = "NA" },
                new Country { Name = "Cote D'Ivoire", Code = "CI", Region = "Other", Continent = "AF" },
                new Country { Name = "Croatia", Code = "HR", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Cuba", Code = "CU", Region = "NA", Continent = "NA" },
                new Country { Name = "Cyprus", Code = "CY", Region = "APAC", Continent = "AS" },
                new Country { Name = "Czech Republic", Code = "CZ", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Denmark", Code = "DK", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Djibouti", Code = "DJ", Region = "Other", Continent = "AF" },
                new Country { Name = "Dominica", Code = "DM", Region = "NA", Continent = "NA" },
                new Country { Name = "Dominican Republic", Code = "DO", Region = "NA", Continent = "NA" },
                new Country { Name = "Ecuador", Code = "EC", Region = "CALA", Continent = "SA" },
                new Country { Name = "Egypt", Code = "EG", Region = "Other", Continent = "AF" },
                new Country { Name = "El Salvador", Code = "SV", Region = "NA", Continent = "NA" },
                new Country { Name = "Equatorial Guinea", Code = "GQ", Region = "Other", Continent = "AF" },
                new Country { Name = "Eritrea", Code = "ER", Region = "Other", Continent = "AF" },
                new Country { Name = "Estonia", Code = "EE", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Ethiopia", Code = "ET", Region = "Other", Continent = "AF" },
                new Country { Name = "Falkland Islands (Malvinas)", Code = "FK", Region = "CALA", Continent = "SA" },
                new Country { Name = "Faroe Islands", Code = "FO", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Fiji", Code = "FJ", Region = "APAC", Continent = "OC" },
                new Country { Name = "Finland", Code = "FI", Region = "EMEA", Continent = "EU" },
                new Country { Name = "France", Code = "FR", Region = "EMEA", Continent = "EU" },
                new Country { Name = "French Guiana", Code = "GF", Region = "CALA", Continent = "SA" },
                new Country { Name = "French Polynesia", Code = "PF", Region = "APAC", Continent = "OC" },
                new Country { Name = "French Southern Territories", Code = "TF", Region = "Other", Continent = "AN" },
                new Country { Name = "Gabon", Code = "GA", Region = "Other", Continent = "AF" },
                new Country { Name = "Gambia", Code = "GM", Region = "Other", Continent = "AF" },
                new Country { Name = "Georgia", Code = "GE", Region = "APAC", Continent = "AS" },
                new Country { Name = "Germany", Code = "DE", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Ghana", Code = "GH", Region = "Other", Continent = "AF" },
                new Country { Name = "Gibraltar", Code = "GI", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Greece", Code = "GR", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Greenland", Code = "GL", Region = "NA", Continent = "NA" },
                new Country { Name = "Grenada", Code = "GD", Region = "NA", Continent = "NA" },
                new Country { Name = "Guadeloupe", Code = "GP", Region = "NA", Continent = "NA" },
                new Country { Name = "Guam", Code = "GU", Region = "APAC", Continent = "OC" },
                new Country { Name = "Guatemala", Code = "GT", Region = "NA", Continent = "NA" },
                new Country { Name = "Guernsey", Code = "GG", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Guinea", Code = "GN", Region = "Other", Continent = "AF" },
                new Country { Name = "Guinea-Bissau", Code = "GW", Region = "Other", Continent = "AF" },
                new Country { Name = "Guyana", Code = "GY", Region = "CALA", Continent = "SA" },
                new Country { Name = "Haiti", Code = "HT", Region = "NA", Continent = "NA" },
                new Country { Name = "Heard Island and Mcdonald Islands", Code = "HM", Region = "Other", Continent = "AN" },
                new Country { Name = "Holy See (Vatican City State)", Code = "VA", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Honduras", Code = "HN", Region = "NA", Continent = "NA" },
                new Country { Name = "Hong Kong", Code = "HK", Region = "APAC", Continent = "AS" },
                new Country { Name = "Hungary", Code = "HU", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Iceland", Code = "IS", Region = "EMEA", Continent = "EU" },
                new Country { Name = "India", Code = "IN", Region = "APAC", Continent = "AS" },
                new Country { Name = "Indonesia", Code = "ID", Region = "APAC", Continent = "AS" },
                new Country { Name = "Iran, Islamic Republic Of", Code = "IR", Region = "APAC", Continent = "AS" },
                new Country { Name = "Iraq", Code = "IQ", Region = "APAC", Continent = "AS" },
                new Country { Name = "Ireland", Code = "IE", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Isle of Man", Code = "IM", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Israel", Code = "IL", Region = "APAC", Continent = "AS" },
                new Country { Name = "Italy", Code = "IT", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Jamaica", Code = "JM", Region = "NA", Continent = "NA" },
                new Country { Name = "Japan", Code = "JP", Region = "APAC", Continent = "AS" },
                new Country { Name = "Jersey", Code = "JE", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Jordan", Code = "JO", Region = "APAC", Continent = "AS" },
                new Country { Name = "Kazakhstan", Code = "KZ", Region = "APAC", Continent = "AS" },
                new Country { Name = "Kenya", Code = "KE", Region = "Other", Continent = "AF" },
                new Country { Name = "Kiribati", Code = "KI", Region = "APAC", Continent = "OC" },
                new Country { Name = "Korea, Democratic People'S Republic of", Code = "KP", Region = "APAC", Continent = "AS" },
                new Country { Name = "Korea, Republic of", Code = "KR", Region = "APAC", Continent = "AS" },
                new Country { Name = "Kuwait", Code = "KW", Region = "APAC", Continent = "AS" },
                new Country { Name = "Kyrgyzstan", Code = "KG", Region = "APAC", Continent = "AS" },
                new Country { Name = "Lao People'S Democratic Republic", Code = "LA", Region = "APAC", Continent = "AS" },
                new Country { Name = "Latvia", Code = "LV", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Lebanon", Code = "LB", Region = "APAC", Continent = "AS" },
                new Country { Name = "Lesotho", Code = "LS", Region = "Other", Continent = "AF" },
                new Country { Name = "Liberia", Code = "LR", Region = "Other", Continent = "AF" },
                new Country { Name = "Libyan Arab Jamahiriya", Code = "LY", Region = "Other", Continent = "AF" },
                new Country { Name = "Liechtenstein", Code = "LI", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Lithuania", Code = "LT", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Luxembourg", Code = "LU", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Macao", Code = "MO", Region = "APAC", Continent = "AS" },
                new Country { Name = "Macedonia, The Former Yugoslav Republic of", Code = "MK", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Madagascar", Code = "MG", Region = "Other", Continent = "AF" },
                new Country { Name = "Malawi", Code = "MW", Region = "Other", Continent = "AF" },
                new Country { Name = "Malaysia", Code = "MY", Region = "APAC", Continent = "AS" },
                new Country { Name = "Maldives", Code = "MV", Region = "APAC", Continent = "AS" },
                new Country { Name = "Mali", Code = "ML", Region = "Other", Continent = "AF" },
                new Country { Name = "Malta", Code = "MT", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Marshall Islands", Code = "MH", Region = "APAC", Continent = "OC" },
                new Country { Name = "Martinique", Code = "MQ", Region = "NA", Continent = "NA" },
                new Country { Name = "Mauritania", Code = "MR", Region = "Other", Continent = "AF" },
                new Country { Name = "Mauritius", Code = "MU", Region = "Other", Continent = "AF" },
                new Country { Name = "Mayotte", Code = "YT", Region = "Other", Continent = "AF" },
                new Country { Name = "Mexico", Code = "MX", Region = "NA", Continent = "NA" },
                new Country { Name = "Micronesia, Federated States of", Code = "FM", Region = "APAC", Continent = "OC" },
                new Country { Name = "Moldova, Republic of", Code = "MD", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Monaco", Code = "MC", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Mongolia", Code = "MN", Region = "APAC", Continent = "AS" },
                new Country { Name = "Montserrat", Code = "MS", Region = "NA", Continent = "NA" },
                new Country { Name = "Morocco", Code = "MA", Region = "Other", Continent = "AF" },
                new Country { Name = "Mozambique", Code = "MZ", Region = "Other", Continent = "AF" },
                new Country { Name = "Myanmar", Code = "MM", Region = "APAC", Continent = "AS" },
                new Country { Name = "Namibia", Code = "NA", Region = "Other", Continent = "AF" },
                new Country { Name = "Nauru", Code = "NR", Region = "APAC", Continent = "OC" },
                new Country { Name = "Nepal", Code = "NP", Region = "APAC", Continent = "AS" },
                new Country { Name = "Netherlands", Code = "NL", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Netherlands Antilles", Code = "AN", Region = "NA", Continent = "NA" },
                new Country { Name = "New Caledonia", Code = "NC", Region = "APAC", Continent = "OC" },
                new Country { Name = "New Zealand", Code = "NZ", Region = "APAC", Continent = "OC" },
                new Country { Name = "Nicaragua", Code = "NI", Region = "NA", Continent = "NA" },
                new Country { Name = "Niger", Code = "NE", Region = "Other", Continent = "AF" },
                new Country { Name = "Nigeria", Code = "NG", Region = "Other", Continent = "AF" },
                new Country { Name = "Niue", Code = "NU", Region = "APAC", Continent = "OC" },
                new Country { Name = "Norfolk Island", Code = "NF", Region = "APAC", Continent = "OC" },
                new Country { Name = "Northern Mariana Islands", Code = "MP", Region = "APAC", Continent = "OC" },
                new Country { Name = "Norway", Code = "NO", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Oman", Code = "OM", Region = "APAC", Continent = "AS" },
                new Country { Name = "Pakistan", Code = "PK", Region = "APAC", Continent = "AS" },
                new Country { Name = "Palau", Code = "PW", Region = "APAC", Continent = "OC" },
                new Country { Name = "Palestinian Territory, Occupied", Code = "PS", Region = "APAC", Continent = "AS" },
                new Country { Name = "Panama", Code = "PA", Region = "NA", Continent = "NA" },
                new Country { Name = "Papua New Guinea", Code = "PG", Region = "APAC", Continent = "OC" },
                new Country { Name = "Paraguay", Code = "PY", Region = "CALA", Continent = "SA" },
                new Country { Name = "Peru", Code = "PE", Region = "CALA", Continent = "SA" },
                new Country { Name = "Philippines", Code = "PH", Region = "APAC", Continent = "AS" },
                new Country { Name = "Pitcairn", Code = "PN", Region = "APAC", Continent = "OC" },
                new Country { Name = "Poland", Code = "PL", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Portugal", Code = "PT", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Puerto Rico", Code = "PR", Region = "NA", Continent = "NA" },
                new Country { Name = "Qatar", Code = "QA", Region = "APAC", Continent = "AS" },
                new Country { Name = "Reunion", Code = "RE", Region = "Other", Continent = "AF" },
                new Country { Name = "Romania", Code = "RO", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Russian Federation", Code = "RU", Region = "EMEA", Continent = "EU" },
                new Country { Name = "RWANDA", Code = "RW", Region = "Other", Continent = "AF" },
                new Country { Name = "Saint Helena", Code = "SH", Region = "Other", Continent = "AF" },
                new Country { Name = "Saint Kitts and Nevis", Code = "KN", Region = "NA", Continent = "NA" },
                new Country { Name = "Saint Lucia", Code = "LC", Region = "NA", Continent = "NA" },
                new Country { Name = "Saint Pierre and Miquelon", Code = "PM", Region = "NA", Continent = "NA" },
                new Country { Name = "Saint Vincent and the Grenadines", Code = "VC", Region = "NA", Continent = "NA" },
                new Country { Name = "Samoa", Code = "WS", Region = "APAC", Continent = "OC" },
                new Country { Name = "San Marino", Code = "SM", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Sao Tome and Principe", Code = "ST", Region = "Other", Continent = "AF" },
                new Country { Name = "Saudi Arabia", Code = "SA", Region = "APAC", Continent = "AS" },
                new Country { Name = "Senegal", Code = "SN", Region = "Other", Continent = "AF" },
                new Country { Name = "Serbia and Montenegro", Code = "CS", Region = "undefined", Continent = "undefined" },
                new Country { Name = "Seychelles", Code = "SC", Region = "Other", Continent = "AF" },
                new Country { Name = "Sierra Leone", Code = "SL", Region = "Other", Continent = "AF" },
                new Country { Name = "Singapore", Code = "SG", Region = "APAC", Continent = "AS" },
                new Country { Name = "Slovakia", Code = "SK", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Slovenia", Code = "SI", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Solomon Islands", Code = "SB", Region = "APAC", Continent = "OC" },
                new Country { Name = "Somalia", Code = "SO", Region = "Other", Continent = "AF" },
                new Country { Name = "South Africa", Code = "ZA", Region = "Other", Continent = "AF" },
                new Country { Name = "South Georgia and the South Sandwich Islands", Code = "GS", Region = "Other", Continent = "AN" },
                new Country { Name = "Spain", Code = "ES", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Sri Lanka", Code = "LK", Region = "APAC", Continent = "AS" },
                new Country { Name = "Sudan", Code = "SD", Region = "Other", Continent = "AF" },
                new Country { Name = "Suriname", Code = "SR", Region = "CALA", Continent = "SA" },
                new Country { Name = "Svalbard and Jan Mayen", Code = "SJ", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Swaziland", Code = "SZ", Region = "Other", Continent = "AF" },
                new Country { Name = "Sweden", Code = "SE", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Switzerland", Code = "CH", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Syrian Arab Republic", Code = "SY", Region = "APAC", Continent = "AS" },
                new Country { Name = "Taiwan, Province of China", Code = "TW", Region = "APAC", Continent = "AS" },
                new Country { Name = "Tajikistan", Code = "TJ", Region = "APAC", Continent = "AS" },
                new Country { Name = "Tanzania, United Republic of", Code = "TZ", Region = "Other", Continent = "AF" },
                new Country { Name = "Thailand", Code = "TH", Region = "APAC", Continent = "AS" },
                new Country { Name = "Timor-Leste", Code = "TL", Region = "APAC", Continent = "AS" },
                new Country { Name = "Togo", Code = "TG", Region = "Other", Continent = "AF" },
                new Country { Name = "Tokelau", Code = "TK", Region = "APAC", Continent = "OC" },
                new Country { Name = "Tonga", Code = "TO", Region = "APAC", Continent = "OC" },
                new Country { Name = "Trinidad and Tobago", Code = "TT", Region = "NA", Continent = "NA" },
                new Country { Name = "Tunisia", Code = "TN", Region = "Other", Continent = "AF" },
                new Country { Name = "Turkey", Code = "TR", Region = "EMEA", Continent = "EU" },
                new Country { Name = "Turkmenistan", Code = "TM", Region = "APAC", Continent = "AS" },
                new Country { Name = "Turks and Caicos Islands", Code = "TC", Region = "NA", Continent = "NA" },
                new Country { Name = "Tuvalu", Code = "TV", Region = "APAC", Continent = "OC" },
                new Country { Name = "Uganda", Code = "UG", Region = "Other", Continent = "AF" },
                new Country { Name = "Ukraine", Code = "UA", Region = "EMEA", Continent = "EU" },
                new Country { Name = "United Arab Emirates", Code = "AE", Region = "APAC", Continent = "AS" },
                new Country { Name = "United Kingdom", Code = "GB", Region = "EMEA", Continent = "EU" },
                new Country { Name = "United States", Code = "US", Region = "NA", Continent = "NA" },
                new Country { Name = "United States Minor Outlying Islands", Code = "UM", Region = "APAC", Continent = "OC" },
                new Country { Name = "Uruguay", Code = "UY", Region = "CALA", Continent = "SA" },
                new Country { Name = "Uzbekistan", Code = "UZ", Region = "APAC", Continent = "AS" },
                new Country { Name = "Vanuatu", Code = "VU", Region = "APAC", Continent = "OC" },
                new Country { Name = "Venezuela", Code = "VE", Region = "CALA", Continent = "SA" },
                new Country { Name = "Viet Nam", Code = "VN", Region = "APAC", Continent = "AS" },
                new Country { Name = "Virgin Islands, British", Code = "VG", Region = "NA", Continent = "NA" },
                new Country { Name = "Virgin Islands, U.S.", Code = "VI", Region = "NA", Continent = "NA" },
                new Country { Name = "Wallis and Futuna", Code = "WF", Region = "APAC", Continent = "OC" },
                new Country { Name = "Western Sahara", Code = "EH", Region = "Other", Continent = "AF" },
                new Country { Name = "Yemen", Code = "YE", Region = "APAC", Continent = "AS" },
                new Country { Name = "Zambia", Code = "ZM", Region = "Other", Continent = "AF" },
                new Country { Name = "Zimbabwe", Code = "ZW", Region = "Other", Continent = "AF" }
            };

            context.Countries.AddRange(countries);
            context.SaveChanges();
        }

        private static void SeedLocales(CoffeeContext context)
        {
            if (context.Locales.Any())
            {
                return;   // DB has been seeded
            }

            var locales = new Locale[]
            {
                new Locale()
                {
                    LocaleId = "en-US",
                    Name = "English"
                },
                new Locale()
                {
                    LocaleId = "fr",
                    Name = "French"
                },
                new Locale()
                {
                    LocaleId = "es",
                    Name = "Spanish"
                }
            };
            context.Locales.AddRange(locales);
            context.SaveChanges();
        }

        private static void SeedSales(IWebHostEnvironment environment, CoffeeContext context)
        {
            if (context.Sales.Any())
            {
                return;
            }

            var importPath = Path.Combine(environment.WebRootPath, @"imports\finserv.csv");

            CultureInfo enUSCulture = new CultureInfo("en-US"); // Fixes data import for non-us users 
            using var reader = new StreamReader(importPath);
            using var csv = new CsvReader(reader, CultureInfo.InvariantCulture);
            var records = csv.GetRecords<SalesImportDTO>();
            IEnumerable<Sale> import = records.Select(dto => new Sale
            {
                Amount = dto.Amount,
                Code = dto.Code,
                Country = dto.Country,
                CustomerInfo = dto.CustomerInfo,
                PromotionId = dto.PromotionId,
                PaymentType = dto.PaymentType,
                Sku = dto.Product,
                ProductGroup = dto.ProductGroup,
                Region = dto.Region,
                StoreId = dto.StoreId,
                TransactionId = dto.TransactionId,
                TransactionDate = DateTime.Parse($"{dto.TransactionDate} {dto.TransactionHour}", enUSCulture.DateTimeFormat)
            });

            context.AddRange(import);
            context.SaveChanges();
        }
    }
}